// Copyright (c) Microsoft Corporation.  All rights reserved.
using System;
using System.Text;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
using Microsoft.CSharp;
using System.Collections;
using Microsoft.VisualStudio.DebuggerVisualizers;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Expressions;

public class ExpressionTreeVisualizerObjectSource : VisualizerObjectSource
{
    public override void GetData(object target, Stream outgoingData)
    {
        Expression expr = (Expression)target;
        ExpressionTreeNode browser = new ExpressionTreeNode(expr);
        browser.Tag = expr;
        ExprTreeContainer container = new ExprTreeContainer(browser, expr.ToString());

        VisualizerObjectSource.Serialize(outgoingData, container);
    }
}

[Serializable]
public class ExprTreeContainer
{
    public ExprTreeContainer(ExpressionTreeNode tree, string expr)
    {
        this.tree = tree;
        this.Expr = expr;

    }
    public ExpressionTreeNode tree;
    public string Expr;
}
